package communication;

import java.util.List;

public class MainTest {
	
	static Communicator comm =new Communicator();
	
	public static void main (String [] args){
				
		//testStuff();
	
		//testRotateSensorMotor();
		//testRotate();
		//testTravel();
		//testCheckBarcode();
		
//		testMultipleCommands();
		testUltrasonic();
		

		

	}

	private static void testUltrasonic() {
//		while(true){
		System.out.println(comm.getDistance());
		comm.travel(40);
		System.out.println(comm.getDistance());
		try {
			Thread.sleep(5000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
			comm.terminate();
//		}
	}

	private static void testMultipleCommands() {
		testTravel();
		testRotateSensorMotor();
		testRotate();
		testRotate();
		testTravel();		
	}

	private static void testCheckBarcode() {
		comm.travel(40);
		while(true)
			System.out.println("awesomef");
		//comm.getBarcode();
		
	}

	private static void testTravel() {
		System.out.println("Testing robot travel...");
		comm.travel(20);
		System.out.println("Testing robot travel COMPLETED");			
	}

	private static void testRotate() {
		System.out.println("Testing robot rotation...");
		comm.rotateRobot(360);
		System.out.println("Testing robot rotation COMPLETED");	
	}

	private static void testRotateSensorMotor() {
		System.out.println("Testing sensor rotation...");
		comm.rotateSensorMotor(90);
		System.out.println("Testing sensor rotation COMPLETED");		
	}

	private static void testStuff() {
		comm.travel(40);
		while(true){
			comm.getBarcode();
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
			}
		}
		//test.terminate();
//		List<Integer> list= test.getList();
//		String result="";
//		for(int value: list){
//			result+=value;
//			result+=" ";
//		}
//		System.out.println(result);
//		//test.getBarcode();
		
	}
	
	
}
